/*
** 1844.c
** 
** Made by (seakage2h)
** Login   <seakage2h@seakage2h-ubuntu>
** 
** Started on  Thu Sep 25 20:32:08 2008 seakage2h
** Last update Sun May 12 01:17:25 2002 Speed Blue
*/

/* #include "1844.h" */
#include <stdio.h>
#include <math.h>

int main()
{
     int s, n;
     scanf("%d", &s);
     n = floor(sqrt(2*s));
     if (n*(n+1) - 2*s < 0)
	  n++;
     while((n*(n+1) - 2*s) % 4 != 0)
	  n++;
     printf("%d\n", n);
     return 0;
}

